package tree;

import javax.swing.*;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Sorctree implements ActionListener {
	
	static int sorctreepoints = 0;
	int totalpoints = 40;
	boolean recentreset = false;
	
	public static int getsorcpoints() {
		return sorctreepoints;
	}
	
	Skill analytics = Sorcskills.analytics();
	Skill coldarmor = Sorcskills.coldarmor();
	Skill coldwave = Sorcskills.coldwave();
	Skill concen = Sorcskills.concentration();
	Skill crystal = Sorcskills.crystal();
	Skill epcrystal = Sorcskills.epcrystal();
	Skill firearmor = Sorcskills.firearmor();
	Skill firearrow = Sorcskills.firearrow();
	Skill fireorb = Sorcskills.fireorb();
	Skill firepillar = Sorcskills.firepillar();
	Skill harmony = Sorcskills.harmony();
	Skill icearrow = Sorcskills.icearrow();
	Skill barrier = Sorcskills.barrier();
	Skill iceorb = Sorcskills.iceorb();
	Skill imbalance = Sorcskills.imbalance();
	Skill impact = Sorcskills.impact();
	Skill intricacy = Sorcskills.intricacy();
	Skill magicmastery = Sorcskills.magicmastery();
	Skill meditation = Sorcskills.meditation();
	Skill meteor = Sorcskills.meteor();
	Skill rapid = Sorcskills.rapid();
	Skill thorns = Sorcskills.thorns();
	Skill tornado = Sorcskills.tornado();
	Skill wisdom = Sorcskills.wisdom();
	
	
	static JFrame frame;
	JPanel masterypanel, skills, row1,row2,row3,row4,row5,row6,row7, masrow1,masrow2,masrow3,
	masrow4,masrow5,masrow6,masrow7;
	
	JButton resetall, reset, def, zerk, cleric, sorc, sin, firearro, rapi, thorn, icearro, analytic, magicmaster, impac, meditatio,
			fireor, barrie, iceor, intricac, firepilla, coldarmo, epcrysta, conce, meteo, firearmo, coldwav, harmon, crysta, wisdo,
			tornad, imbalanc;
	
	JLabel title1, title2, info, firearr, arr1, arr2, arr3, arr4, rap, thor, icearr, analyti, magicmaste, impa, meditati, 
			fireo, barri, iceo, intrica, firepill, coldarm, epcryst, conc, mete, firearm, coldwa, harmo, cryst, wisd, torna, imbalan,
			awake, awak, cross, cros, affin1, affin11, affin2, affin22, affin3, affin33, dyna1, dyna11, dyna2, dyna22;
	
	static JPanel allpanels;
	
	public JPanel createContentPane (){
		
		totalpoints = 40;
		sorctreepoints = 0;
		ImageIcon img;
		Image test;
		Image newimg;
		
		ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);

        allpanels = new JPanel();
        allpanels.setLayout(null);
		
        title1 = new JLabel("Actives/Passives");
        title1.setLocation(5, 0);
        title1.setSize(430,20);
        title1.setHorizontalAlignment(0);
        title1.setOpaque(true);
        title1.setBackground(Color.gray);
        allpanels.add(title1);
        
        title2 = new JLabel("Masteries");
        title2.setLocation(435, 0);
        title2.setSize(110,20);
        title2.setHorizontalAlignment(0);
        title2.setOpaque(true);
        title2.setBackground(Color.gray);
        allpanels.add(title2);
        
        skills = new JPanel();
        skills.setLayout(null);
        skills.setSize(430, 430);
        skills.setLocation(5,20);
        allpanels.add(skills);
        
        masterypanel = new JPanel();
        masterypanel.setLayout(null);
        masterypanel.setSize(110, 430);
        masterypanel.setLocation(435,20);
        allpanels.add(masterypanel);
        
        def = new JButton();
        def.setText("Defender(0)");
        def.setSize(110,20);
        def.setLocation(5, 450);
        def.setHorizontalAlignment( SwingConstants.LEFT );
        def.addActionListener(this);
        allpanels.add(def);
        
        zerk = new JButton();
        zerk.setText("Berserker(0)");
        zerk.setSize(120,20);
        zerk.setLocation(115, 450);
        zerk.setHorizontalAlignment( SwingConstants.LEFT );
        zerk.addActionListener(this);
        allpanels.add(zerk);
        
        cleric = new JButton();
        cleric.setText("Cleric(0)");
        cleric.setSize(90,20);
        cleric.setLocation(235, 450);
        cleric.setHorizontalAlignment( SwingConstants.CENTER );
        cleric.addActionListener(this);
        allpanels.add(cleric);
        
        sorc = new JButton();
        sorc.setText("Sorcerer(0)");
        sorc.setSize(110,20);
        sorc.setLocation(325, 450);
        sorc.setHorizontalAlignment( SwingConstants.LEFT );
        sorc.addActionListener(this);
        allpanels.add(sorc);
        
        sin = new JButton();
        sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
        sin.setSize(110,20);
        sin.setLocation(435, 450);
        sin.setHorizontalAlignment( SwingConstants.LEFT );
        sin.addActionListener(this);
        allpanels.add(sin);
        
        
        info = new JLabel();
        info.setText("<html>Points Used: " + sorctreepoints + "<br>Points Left: " + (totalpoints-(sorctreepoints)) + "</html>");
        info.setSize(550,40);
        info.setHorizontalAlignment( SwingConstants.CENTER );
        info.setLocation(0, 470);
        allpanels.add(info);
        
        reset = new JButton();
        reset.setText("Reset Tree");
        reset.setSize(100, 20);
        reset.setLocation(225, 510);
        reset.setHorizontalAlignment( SwingConstants.CENTER );
        reset.addActionListener(this);
        allpanels.add(reset);
        
        resetall = new JButton("Reset All");
        resetall.setSize(100, 20);
        resetall.setLocation(225, 530);
        resetall.setHorizontalAlignment( SwingConstants.CENTER );
        resetall.addActionListener(this);
        allpanels.add(resetall);
        
        
        
      //masteries
        masrow1 = new JPanel();
        masrow1.setLayout(null);
        masrow1.setLocation(0, 0);
        masrow1.setSize(110, 60);
        masrow1.setBackground(Color.lightGray);
        masrow1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow1);
        
      //Awakening
        img = new ImageIcon(getClass().getResource("/sorc/awakening.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        awake = new JLabel();
        awake.setSize(40,40);
        awake.setToolTipText("<html>Awakening<br>Increases attack speed by 10%, casting speed by 100% and attack by 5% for 10 seconds.<br>" +
        										"This skill can only be used when both Ice Magic and Fire Magic are active, and will<br>" +
        										"consume these effects on use.<br>Cooldown:120 secs<br>" +
        						"Requires 5+ points in sorcerer</html>");
        awake.setLocation(35, 10);
        awake.setOpaque(true);
        awake.setBackground(new Color(128,128,128,175));
        masrow1.add(awake);
        
        awak = new JLabel((Icon) img);
        awak.setSize(40,40);
        awak.setLocation(35, 10);
        masrow1.add(awak);
        
      //masrow2
        masrow2 = new JPanel();
        masrow2.setLayout(null);
        masrow2.setLocation(0, 60);
        masrow2.setSize(110, 60);
        masrow2.setBackground(Color.lightGray);
        masrow2.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow2);
        
      //Style mastery
        img = new ImageIcon(getClass().getResource("/sorc/stylemastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        cross = new JLabel();
        cross.setSize(40,40);
        cross.setToolTipText("<html>Style Mastery: Sorcerer<br>Allows you learn skills of other styles.<br>" +
        						"Requires 10+ points in sorcerer</html>");
        cross.setLocation(35, 10);
        cross.setOpaque(true);
        cross.setBackground(new Color(128,128,128,175));
        masrow2.add(cross);
        
        cros = new JLabel((Icon) img);
        cros.setSize(40,40);
        cros.setLocation(35, 10);
        masrow2.add(cros);
        
      //masrow3
        masrow3 = new JPanel();
        masrow3.setLayout(null);
        masrow3.setLocation(0, 120);
        masrow3.setSize(110, 60);
        masrow3.setBackground(Color.lightGray);
        masrow3.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow3);
        
      //Magic affinity
        img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        affin1 = new JLabel();
        affin1.setSize(40,40);
        affin1.setToolTipText("<html>Magic Affinity<br>Magic Attack is increased by 4%.<br>" +
        						"Requires 15+ points in sorcerer</html>");
        affin1.setLocation(35, 10);
        affin1.setOpaque(true);
        affin1.setBackground(new Color(128,128,128,175));
        masrow3.add(affin1);
        
        affin11 = new JLabel((Icon) img);
        affin11.setSize(40,40);
        affin11.setLocation(35, 10);
        masrow3.add(affin11);
        
      //masrow4
        masrow4 = new JPanel();
        masrow4.setLayout(null);
        masrow4.setLocation(0, 180);
        masrow4.setSize(110, 60);
        masrow4.setBackground(Color.lightGray);
        masrow4.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow4);
        
      //Elemental Dynamics
        img = new ImageIcon(getClass().getResource("/sorc/dynamics.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        dyna1 = new JLabel();
        dyna1.setSize(40,40);
        dyna1.setToolTipText("<html>Elemental Dynamics<br>Allows the Ice Magic and Fire Magic effects to stack 2 times.<br>" +
        						"Requires 20+ points in sorcerer</html>");
        dyna1.setLocation(35, 10);
        dyna1.setOpaque(true);
        dyna1.setBackground(new Color(128,128,128,175));
        masrow4.add(dyna1);
        
        dyna11 = new JLabel((Icon) img);
        dyna11.setSize(40,40);
        dyna11.setLocation(35, 10);
        masrow4.add(dyna11);
        
        
      //masrow5
        masrow5 = new JPanel();
        masrow5.setLayout(null);
        masrow5.setLocation(0, 240);
        masrow5.setSize(110, 60);
        masrow5.setBackground(Color.lightGray);
        masrow5.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow5);
        
      //Magic affinity
        img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        affin2 = new JLabel();
        affin2.setSize(40,40);
        affin2.setToolTipText("<html>Magic Affinity 2<br>Magic Attack is increased by 7%.<br>" +
        						"Requires 25+ points in sorcerer</html>");
        affin2.setLocation(35, 10);
        affin2.setOpaque(true);
        affin2.setBackground(new Color(128,128,128,175));
        masrow5.add(affin2);
        
        affin22 = new JLabel((Icon) img);
        affin22.setSize(40,40);
        affin22.setLocation(35, 10);
        masrow5.add(affin22);
        
      //masrow6
        masrow6 = new JPanel();
        masrow6.setLayout(null);
        masrow6.setLocation(0, 300);
        masrow6.setSize(110, 60);
        masrow6.setBackground(Color.lightGray);
        masrow6.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow6);
        
      //Elemental Dynamics
        img = new ImageIcon(getClass().getResource("/sorc/dynamics.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        dyna2 = new JLabel();
        dyna2.setSize(40,40);
        dyna2.setToolTipText("<html>Elemental Dynamics 2<br>Allows the Ice Magic and Fire Magic effects to stack 3 times.<br>" +
        						"Requires 30+ points in sorcerer</html>");
        dyna2.setLocation(35, 10);
        dyna2.setOpaque(true);
        dyna2.setBackground(new Color(128,128,128,175));
        masrow6.add(dyna2);
        
        dyna22 = new JLabel((Icon) img);
        dyna22.setSize(40,40);
        dyna22.setLocation(35, 10);
        masrow6.add(dyna22);
        
        
      //masrow7
        masrow7 = new JPanel();
        masrow7.setLayout(null);
        masrow7.setLocation(0, 360);
        masrow7.setSize(110, 60);
        masrow7.setBackground(Color.lightGray);
        masrow7.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.BLACK));
        masterypanel.add(masrow7);
        
      //Magic affinity
        img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        affin3 = new JLabel();
        affin3.setSize(40,40);
        affin3.setToolTipText("<html>Magic Affinity 3<br>Magic Attack is increased by 10%.<br>" +
        						"Requires 35+ points in sorcerer</html>");
        affin3.setLocation(35, 10);
        affin3.setOpaque(true);
        affin3.setBackground(new Color(128,128,128,175));
        masrow7.add(affin3);
        
        affin33 = new JLabel((Icon) img);
        affin33.setSize(40,40);
        affin33.setLocation(35, 10);
        masrow7.add(affin33);
        
        
        
        
        //row1
        row1 = new JPanel();
        row1.setLayout(null);
        row1.setLocation(0, 0);
        row1.setSize(430, 60);
        row1.setBackground(Color.lightGray);
        row1.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.BLACK));
        skills.add(row1);
        
      //Fire Arrow
        img = new ImageIcon(getClass().getResource("/sorc/firearrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        firearro = new JButton((Icon) img);
        firearro.setToolTipText("<html>" + firearrow.popup() + "</html>");
        firearro.setSize(40, 40);
        firearro.setLocation(10, 10);
        firearro.addActionListener(this);
        row1.add(firearro);
        
        firearr = new JLabel();
        firearr.setText(firearrow.getlv() + "/" + firearrow.getmax());
        firearr.setSize(20,20);
        firearr.setLocation(50, 30);
        row1.add(firearr);
        
      //Rapid Blasts
        img = new ImageIcon(getClass().getResource("/sorc/rapid.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        rapi = new JButton((Icon) img);
        rapi.setToolTipText("<html>" + rapid.popup() + "</html>");
        rapi.setSize(40, 40);
        rapi.setLocation(80, 10);
        rapi.addActionListener(this);
        row1.add(rapi);
        
        rap = new JLabel();
        rap.setText(rapid.getlv() + "/" + rapid.getmax());
        rap.setSize(20,20);
        rap.setLocation(120, 30);
        row1.add(rap);
        
      //Ice Thorns
        img = new ImageIcon(getClass().getResource("/sorc/thorns.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        thorn = new JButton((Icon) img);
        thorn.setToolTipText("<html>" + thorns.popup() + "</html>");
        thorn.setSize(40, 40);
        thorn.setLocation(150, 10);
        thorn.addActionListener(this);
        row1.add(thorn);
        
        thor = new JLabel();
        thor.setText(thorns.getlv() + "/" + thorns.getmax());
        thor.setSize(20,20);
        thor.setLocation(190, 30);
        row1.add(thor);
        
      //Ice Arrow
        img = new ImageIcon(getClass().getResource("/sorc/icearrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        icearro = new JButton((Icon) img);
        icearro.setToolTipText("<html>" + icearrow.popup() + "</html>");
        icearro.setSize(40, 40);
        icearro.setLocation(220, 10);
        icearro.addActionListener(this);
        row1.add(icearro);
        
        icearr = new JLabel();
        icearr.setText(icearrow.getlv() + "/" + icearrow.getmax());
        icearr.setSize(20,20);
        icearr.setLocation(260, 30);
        row1.add(icearr);
        
      //Analytics
        img = new ImageIcon(getClass().getResource("/sorc/analytics.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        analytic = new JButton((Icon) img);
        analytic.setToolTipText("<html>" + analytics.popup() + "</html>");
        analytic.setSize(40, 40);
        analytic.setLocation(290, 10);
        analytic.addActionListener(this);
        row1.add(analytic);
        
        analyti = new JLabel();
        analyti.setText(analytics.getlv() + "/" + analytics.getmax());
        analyti.setSize(20,20);
        analyti.setLocation(330, 30);
        row1.add(analyti);
        
      //Magic Mastery
        img = new ImageIcon(getClass().getResource("/sorc/magicmastery.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        magicmaster = new JButton((Icon) img);
        magicmaster.setToolTipText("<html>" + magicmastery.popup() + "</html>");
        magicmaster.setSize(40, 40);
        magicmaster.setLocation(360, 10);
        magicmaster.addActionListener(this);
        row1.add(magicmaster);
        
        magicmaste = new JLabel();
        magicmaste.setText(magicmastery.getlv() + "/" + magicmastery.getmax());
        magicmaste.setSize(20,20);
        magicmaste.setLocation(400, 30);
        row1.add(magicmaste);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 20,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr4 = new JLabel((Icon) img);
        arr4.setSize(20,20);
        arr4.setLocation(90, 50);
        skills.add(arr4,0);
        
      //row2
        row2 = new JPanel();
        row2.setLayout(null);
        row2.setLocation(0, 60);
        row2.setSize(430, 60);
        row2.setBackground(Color.lightGray);
        row2.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row2);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(20, 1);
        row2.add(arr1);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr2 = new JLabel((Icon) img);
        arr2.setSize(20,58);
        arr2.setLocation(160, 1);
        row2.add(arr2);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,58);
        arr3.setLocation(230, 1);
        row2.add(arr3);
        
      //Flame Impact
        img = new ImageIcon(getClass().getResource("/sorc/impact.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        impac = new JButton((Icon) img);
        impac.setToolTipText("<html>" + impact.popup() + "</html>");
        impac.setSize(40, 40);
        impac.setLocation(80, 10);
        impac.addActionListener(this);
        row2.add(impac);
        
        impa = new JLabel();
        impa.setText(impact.getlv() + "/" + impact.getmax());
        impa.setSize(20,20);
        impa.setLocation(120, 30);
        row2.add(impa);
        
      //Meditation
        img = new ImageIcon(getClass().getResource("/sorc/meditation.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        meditatio = new JButton((Icon) img);
        meditatio.setToolTipText("<html>" + meditation.popup() + "</html>");
        meditatio.setSize(40, 40);
        meditatio.setLocation(290, 10);
        meditatio.addActionListener(this);
        row2.add(meditatio);
        
        meditati = new JLabel();
        meditati.setText(meditation.getlv() + "/" + meditation.getmax());
        meditati.setSize(20,20);
        meditati.setLocation(330, 30);
        row2.add(meditati);
        
      //row3
        row3 = new JPanel();
        row3.setLayout(null);
        row3.setLocation(0, 120);
        row3.setSize(430, 60);
        row3.setBackground(Color.lightGray);
        row3.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row3);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(90, 1);
        row3.add(arr1);
        
        arr2 = new JLabel((Icon) img);
        arr2.setSize(20,58);
        arr2.setLocation(300, 1);
        row3.add(arr2);
        
      //Fire Orb
        img = new ImageIcon(getClass().getResource("/sorc/fireorb.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        fireor = new JButton((Icon) img);
        fireor.setToolTipText("<html>" + fireorb.popup() + "</html>");
        fireor.setSize(40, 40);
        fireor.setLocation(10, 10);
        fireor.addActionListener(this);
        row3.add(fireor);
        
        fireo = new JLabel();
        fireo.setText(fireorb.getlv() + "/" + fireorb.getmax());
        fireo.setSize(20,20);
        fireo.setLocation(50, 30);
        row3.add(fireo);
        
      //Ice Barrier
        img = new ImageIcon(getClass().getResource("/sorc/icebarrier.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        barrie = new JButton((Icon) img);
        barrie.setToolTipText("<html>" + barrier.popup() + "</html>");
        barrie.setSize(40, 40);
        barrie.setLocation(150, 10);
        barrie.addActionListener(this);
        row3.add(barrie);
        
        barri = new JLabel();
        barri.setText(barrier.getlv() + "/" + barrier.getmax());
        barri.setSize(20,20);
        barri.setLocation(190, 30);
        row3.add(barri);
        
      //Ice Orb
        img = new ImageIcon(getClass().getResource("/sorc/iceorb.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        iceor = new JButton((Icon) img);
        iceor.setToolTipText("<html>" + iceorb.popup() + "</html>");
        iceor.setSize(40, 40);
        iceor.setLocation(220, 10);
        iceor.addActionListener(this);
        row3.add(iceor);
        
        iceo = new JLabel();
        iceo.setText(iceorb.getlv() + "/" + iceorb.getmax());
        iceo.setSize(20,20);
        iceo.setLocation(260, 30);
        row3.add(iceo);
        
      //Intricacy
        img = new ImageIcon(getClass().getResource("/sorc/intricacy.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        intricac = new JButton((Icon) img);
        intricac.setToolTipText("<html>" + intricacy.popup() + "</html>");
        intricac.setSize(40, 40);
        intricac.setLocation(360, 10);
        intricac.addActionListener(this);
        row3.add(intricac);
        
        intrica = new JLabel();
        intrica.setText(intricacy.getlv() + "/" + intricacy.getmax());
        intrica.setSize(20,20);
        intrica.setLocation(400, 30);
        row3.add(intrica);
        
      //row4
        row4 = new JPanel();
        row4.setLayout(null);
        row4.setLocation(0, 180);
        row4.setSize(430, 60);
        row4.setBackground(Color.lightGray);
        row4.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row4);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(20, 1);
        row4.add(arr1);
        
        arr3 = new JLabel((Icon) img);
        arr3.setSize(20,58);
        arr3.setLocation(230, 1);
        row4.add(arr3);
        
      //Flame Pillar
        img = new ImageIcon(getClass().getResource("/sorc/firepillar.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        firepilla = new JButton((Icon) img);
        firepilla.setToolTipText("<html>" + firepillar.popup() + "</html>");
        firepilla.setSize(40, 40);
        firepilla.setLocation(80, 10);
        firepilla.addActionListener(this);
        row4.add(firepilla);
        
        firepill = new JLabel();
        firepill.setText(firepillar.getlv() + "/" + firepillar.getmax());
        firepill.setSize(20,20);
        firepill.setLocation(120, 30);
        row4.add(firepill);
        
      //Cold Armor
        img = new ImageIcon(getClass().getResource("/sorc/coldarmor.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        coldarmo = new JButton((Icon) img);
        coldarmo.setToolTipText("<html>" + coldarmor.popup() + "</html>");
        coldarmo.setSize(40, 40);
        coldarmo.setLocation(150, 10);
        coldarmo.addActionListener(this);
        row4.add(coldarmo);
        
        coldarm = new JLabel();
        coldarm.setText(coldarmor.getlv() + "/" + coldarmor.getmax());
        coldarm.setSize(20,20);
        coldarm.setLocation(190, 30);
        row4.add(coldarm);
        
      //Magic Crystal
        img = new ImageIcon(getClass().getResource("/sorc/epcrystal.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        epcrysta = new JButton((Icon) img);
        epcrysta.setToolTipText("<html>" + epcrystal.popup() + "</html>");
        epcrysta.setSize(40, 40);
        epcrysta.setLocation(290, 10);
        epcrysta.addActionListener(this);
        row4.add(epcrysta);
        
        epcryst = new JLabel();
        epcryst.setText(epcrystal.getlv() + "/" + epcrystal.getmax());
        epcryst.setSize(20,20);
        epcryst.setLocation(330, 30);
        row4.add(epcryst);
        
      //Flame Concentration
        img = new ImageIcon(getClass().getResource("/sorc/concentration.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        conce = new JButton((Icon) img);
        conce.setToolTipText("<html>" + concen.popup() + "</html>");
        conce.setSize(40, 40);
        conce.setLocation(360, 10);
        conce.addActionListener(this);
        row4.add(conce);
        
        conc = new JLabel();
        conc.setText(concen.getlv() + "/" + concen.getmax());
        conc.setSize(20,20);
        conc.setLocation(400, 30);
        row4.add(conc);
        
      //row5
        row5 = new JPanel();
        row5.setLayout(null);
        row5.setLocation(0, 240);
        row5.setSize(430, 60);
        row5.setBackground(Color.lightGray);
        row5.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row5);
        
      //Meteor
        img = new ImageIcon(getClass().getResource("/sorc/meteor.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        meteo = new JButton((Icon) img);
        meteo.setToolTipText("<html>" + meteor.popup() + "</html>");
        meteo.setSize(40, 40);
        meteo.setLocation(10, 10);
        meteo.addActionListener(this);
        row5.add(meteo);
        
        mete = new JLabel();
        mete.setText(meteor.getlv() + "/" + meteor.getmax());
        mete.setSize(20,20);
        mete.setLocation(50, 30);
        row5.add(mete);
        
      //Flame Armor
        img = new ImageIcon(getClass().getResource("/sorc/firearmor.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        firearmo = new JButton((Icon) img);
        firearmo.setToolTipText("<html>" + firearmor.popup() + "</html>");
        firearmo.setSize(40, 40);
        firearmo.setLocation(80, 10);
        firearmo.addActionListener(this);
        row5.add(firearmo);
        
        firearm = new JLabel();
        firearm.setText(firearmor.getlv() + "/" + firearmor.getmax());
        firearm.setSize(20,20);
        firearm.setLocation(120, 30);
        row5.add(firearm);
        
      //Cold Wave
        img = new ImageIcon(getClass().getResource("/sorc/coldwave.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        coldwav = new JButton((Icon) img);
        coldwav.setToolTipText("<html>" + coldwave.popup() + "</html>");
        coldwav.setSize(40, 40);
        coldwav.setLocation(220, 10);
        coldwav.addActionListener(this);
        row5.add(coldwav);
        
        coldwa = new JLabel();
        coldwa.setText(coldwave.getlv() + "/" + coldwave.getmax());
        coldwa.setSize(20,20);
        coldwa.setLocation(260, 30);
        row5.add(coldwa);
        
      //Harmony
        img = new ImageIcon(getClass().getResource("/sorc/harmony.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        harmon = new JButton((Icon) img);
        harmon.setToolTipText("<html>" + harmony.popup() + "</html>");
        harmon.setSize(40, 40);
        harmon.setLocation(360, 10);
        harmon.addActionListener(this);
        row5.add(harmon);
        
        harmo = new JLabel();
        harmo.setText(harmony.getlv() + "/" + harmony.getmax());
        harmo.setSize(20,20);
        harmo.setLocation(400, 30);
        row5.add(harmo);
        
      //row6
        row6 = new JPanel();
        row6.setLayout(null);
        row6.setLocation(0, 300);
        row6.setSize(430, 60);
        row6.setBackground(Color.lightGray);
        row6.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row6);
        
        img = new ImageIcon(getClass().getResource("/sorc/downarrow.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(20, 58,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        arr1 = new JLabel((Icon) img);
        arr1.setSize(20,58);
        arr1.setLocation(90, 1);
        row6.add(arr1);
        
      //Crystal
        img = new ImageIcon(getClass().getResource("/sorc/crystal.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        crysta = new JButton((Icon) img);
        crysta.setToolTipText("<html>" + crystal.popup() + "</html>");
        crysta.setSize(40, 40);
        crysta.setLocation(150, 10);
        crysta.addActionListener(this);
        row6.add(crysta);
        
        cryst = new JLabel();
        cryst.setText(crystal.getlv() + "/" + crystal.getmax());
        cryst.setSize(20,20);
        cryst.setLocation(190, 30);
        row6.add(cryst);
        
      //Wisdom
        img = new ImageIcon(getClass().getResource("/sorc/wisdom.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        wisdo = new JButton((Icon) img);
        wisdo.setToolTipText("<html>" + wisdom.popup() + "</html>");
        wisdo.setSize(40, 40);
        wisdo.setLocation(290, 10);
        wisdo.addActionListener(this);
        row6.add(wisdo);
        
        wisd = new JLabel();
        wisd.setText(wisdom.getlv() + "/" + wisdom.getmax());
        wisd.setSize(20,20);
        wisd.setLocation(330, 30);
        row6.add(wisd);
        
      //row7
        row7 = new JPanel();
        row7.setLayout(null);
        row7.setLocation(0, 360);
        row7.setSize(430, 60);
        row7.setBackground(Color.lightGray);
        row7.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLACK));
        skills.add(row7);
        
      //Flame tornado
        img = new ImageIcon(getClass().getResource("/sorc/tornado.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        tornad = new JButton((Icon) img);
        tornad.setToolTipText("<html>" + tornado.popup() + "</html>");
        tornad.setSize(40, 40);
        tornad.setLocation(80, 10);
        tornad.addActionListener(this);
        row7.add(tornad);
        
        torna = new JLabel();
        torna.setText(tornado.getlv() + "/" + tornado.getmax());
        torna.setSize(20,20);
        torna.setLocation(120, 30);
        row7.add(torna);
        
      //Imbalance
        img = new ImageIcon(getClass().getResource("/sorc/imbalance.png"));
        test = img.getImage();
        newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
        img = new ImageIcon(newimg);
        imbalanc = new JButton((Icon) img);
        imbalanc.setToolTipText("<html>" + imbalance.popup() + "</html>");
        imbalanc.setSize(40, 40);
        imbalanc.setLocation(360, 10);
        imbalanc.addActionListener(this);
        row7.add(imbalanc);
        
        imbalan = new JLabel();
        imbalan.setText(imbalance.getlv() + "/" + imbalance.getmax());
        imbalan.setSize(20,20);
        imbalan.setLocation(400, 30);
        row7.add(imbalan);
        
        
        
        
        
        
        allpanels.setOpaque(true);
        return allpanels;
        
        
        
	}
	
	
	public void updatesorc() {
		int allpoints = (Deftree.getdefpoints()+Sintree.getsinpoints()+sorctreepoints+Clertree.getclerpoints()+Zerktree.getzerkpoints());
		info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
		sin.setText("Assassin(" + Sintree.getsinpoints() + ")");
		def.setText("Defender(" + Deftree.getdefpoints() + ")");
		cleric.setText("Cleric(" + Clertree.getclerpoints() + ")");
		zerk.setText("Berserker(" + Zerktree.getzerkpoints() + ")");
		
	}
	
	public void recentset() {
		recentreset = true;
	}
	
	public void actionPerformed(ActionEvent e) {
		int allpoints = (sorctreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Clertree.getclerpoints()+Zerktree.getzerkpoints());
		
		if(e.getSource() == reset) {
			sorctreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetsorc();
			
        } else if(e.getSource() == def) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());avenaei
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchdef(); 
			
        }	else if(e.getSource() == resetall) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
	        Alltrees.resetall(); 
			
        }else if(e.getSource() == cleric) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchcler(); 
			
        }else if(e.getSource() == sin) {
			//deftreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchsin();
        }else if(e.getSource() == zerk) {
			//sintreepoints = 0;
			//frame.setContentPane(demo.createContentPane());
	        //frame.setVisible(true);
        	recentreset = false;
	        Alltrees.switchzerk(); 
			
        }
		// row1
        else if ((Sintree.getsinpoints() == 0 && Deftree.getdefpoints() == 0 && Clertree.getclerpoints() == 0 && Zerktree.getzerkpoints() == 0) || Sintree.getsinpoints() >= 10 || Deftree.getdefpoints() >= 10 ||
        		sorctreepoints >= 10 || Clertree.getclerpoints() >= 10 || recentreset || Zerktree.getzerkpoints() >= 10) {
			if(e.getSource() == firearro) {
				if (firearrow.getlv() < firearrow.getmax() && firearrow.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					firearrow.setcurlv(firearrow.getlv()+1);
					firearro.setToolTipText("<html>" + firearrow.popup() + "</html>");
					firearr.setText(firearrow.getlv() + "/" + firearrow.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == rapi) {
				if (rapid.getlv() < rapid.getmax() && rapid.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					rapid.setcurlv(rapid.getlv()+1);
					rapi.setToolTipText("<html>" + rapid.popup() + "</html>");
					rap.setText(rapid.getlv() + "/" + rapid.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == thorn) {
				if (thorns.getlv() < thorns.getmax() && thorns.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					thorns.setcurlv(thorns.getlv()+1);
					thorn.setToolTipText("<html>" + thorns.popup() + "</html>");
					thor.setText(thorns.getlv() + "/" + thorns.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == icearro) {
				if (icearrow.getlv() < icearrow.getmax() && icearrow.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					icearrow.setcurlv(icearrow.getlv()+1);
					icearro.setToolTipText("<html>" + icearrow.popup() + "</html>");
					icearr.setText(icearrow.getlv() + "/" + icearrow.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == analytic) {
				if (analytics.getlv() < analytics.getmax() && analytics.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					analytics.setcurlv(analytics.getlv()+1);
					analytic.setToolTipText("<html>" + analytics.popup() + "</html>");
					analyti.setText(analytics.getlv() + "/" + analytics.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == magicmaster) {
				if (magicmastery.getlv() < magicmastery.getmax() && magicmastery.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					magicmastery.setcurlv(magicmastery.getlv()+1);
					magicmaster.setToolTipText("<html>" + magicmastery.popup() + "</html>");
					magicmaste.setText(magicmastery.getlv() + "/" + magicmastery.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row2
			else if(e.getSource() == impac) {
				if (impact.getlv() < impact.getmax() && impact.getpoints() <= sorctreepoints && totalpoints > allpoints && rapid.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					impact.setcurlv(impact.getlv()+1);
					impac.setToolTipText("<html>" + impact.popup() + "</html>");
					impa.setText(impact.getlv() + "/" + impact.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == meditatio) {
				if (meditation.getlv() < meditation.getmax() && meditation.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					meditation.setcurlv(meditation.getlv()+1);
					meditatio.setToolTipText("<html>" + meditation.popup() + "</html>");
					meditati.setText(meditation.getlv() + "/" + meditation.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row3
			else if(e.getSource() == fireor) {
				if (fireorb.getlv() < fireorb.getmax() && fireorb.getpoints() <= sorctreepoints && totalpoints > allpoints && firearrow.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					fireorb.setcurlv(fireorb.getlv()+1);
					fireor.setToolTipText("<html>" + fireorb.popup() + "</html>");
					fireo.setText(fireorb.getlv() + "/" + fireorb.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == barrie) {
				if (barrier.getlv() < barrier.getmax() && barrier.getpoints() <= sorctreepoints && totalpoints > allpoints && thorns.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					barrier.setcurlv(barrier.getlv()+1);
					barrie.setToolTipText("<html>" + barrier.popup() + "</html>");
					barri.setText(barrier.getlv() + "/" + barrier.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == iceor) {
				if (iceorb.getlv() < iceorb.getmax() && iceorb.getpoints() <= sorctreepoints && totalpoints > allpoints && icearrow.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					iceorb.setcurlv(iceorb.getlv()+1);
					iceor.setToolTipText("<html>" + iceorb.popup() + "</html>");
					iceo.setText(iceorb.getlv() + "/" + iceorb.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == intricac) {
				if (intricacy.getlv() < intricacy.getmax() && intricacy.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					intricacy.setcurlv(intricacy.getlv()+1);
					intricac.setToolTipText("<html>" + intricacy.popup() + "</html>");
					intrica.setText(intricacy.getlv() + "/" + intricacy.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row4
			else if(e.getSource() == firepilla) {
				if (firepillar.getlv() < firepillar.getmax() && firepillar.getpoints() <= sorctreepoints && totalpoints > allpoints && impact.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					firepillar.setcurlv(firepillar.getlv()+1);
					firepilla.setToolTipText("<html>" + firepillar.popup() + "</html>");
					firepill.setText(firepillar.getlv() + "/" + firepillar.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == coldarmo) {
				if (coldarmor.getlv() < coldarmor.getmax() && coldarmor.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					coldarmor.setcurlv(coldarmor.getlv()+1);
					coldarmo.setToolTipText("<html>" + coldarmor.popup() + "</html>");
					coldarm.setText(coldarmor.getlv() + "/" + coldarmor.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == epcrysta) {
				if (epcrystal.getlv() < epcrystal.getmax() && epcrystal.getpoints() <= sorctreepoints && totalpoints > allpoints && meditation.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					epcrystal.setcurlv(epcrystal.getlv()+1);
					epcrysta.setToolTipText("<html>" + epcrystal.popup() + "</html>");
					epcryst.setText(epcrystal.getlv() + "/" + epcrystal.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == conce) {
				if (concen.getlv() < concen.getmax() && concen.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					concen.setcurlv(concen.getlv()+1);
					conce.setToolTipText("<html>" + concen.popup() + "</html>");
					conc.setText(concen.getlv() + "/" + concen.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row5
			else if(e.getSource() == meteo) {
				if (meteor.getlv() < meteor.getmax() && meteor.getpoints() <= sorctreepoints && totalpoints > allpoints && fireorb.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					meteor.setcurlv(meteor.getlv()+1);
					meteo.setToolTipText("<html>" + meteor.popup() + "</html>");
					mete.setText(meteor.getlv() + "/" + meteor.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == firearmo) {
				if (firearmor.getlv() < firearmor.getmax() && firearmor.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					firearmor.setcurlv(firearmor.getlv()+1);
					firearmo.setToolTipText("<html>" + firearmor.popup() + "</html>");
					firearm.setText(firearmor.getlv() + "/" + firearmor.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == coldwav) {
				if (coldwave.getlv() < coldwave.getmax() && coldwave.getpoints() <= sorctreepoints && totalpoints > allpoints && iceorb.getlv() > 0) {
					sorctreepoints ++;
					allpoints ++;
					coldwave.setcurlv(coldwave.getlv()+1);
					coldwav.setToolTipText("<html>" + coldwave.popup() + "</html>");
					coldwa.setText(coldwave.getlv() + "/" + coldwave.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == harmon) {
				if (harmony.getlv() < harmony.getmax() && harmony.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					harmony.setcurlv(harmony.getlv()+1);
					harmon.setToolTipText("<html>" + harmony.popup() + "</html>");
					harmo.setText(harmony.getlv() + "/" + harmony.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row6
			else if(e.getSource() == crysta) {
				if (crystal.getlv() < crystal.getmax() && crystal.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					crystal.setcurlv(crystal.getlv()+1);
					crysta.setToolTipText("<html>" + crystal.popup() + "</html>");
					cryst.setText(crystal.getlv() + "/" + crystal.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == wisdo) {
				if (wisdom.getlv() < wisdom.getmax() && wisdom.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					wisdom.setcurlv(wisdom.getlv()+1);
					wisdo.setToolTipText("<html>" + wisdom.popup() + "</html>");
					wisd.setText(wisdom.getlv() + "/" + wisdom.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} //row7
			else if(e.getSource() == tornad) {
				if (tornado.getlv() < tornado.getmax() && tornado.getpoints() <= sorctreepoints && totalpoints > allpoints && firearmor.getlv() >0) {
					sorctreepoints ++;
					allpoints ++;
					tornado.setcurlv(tornado.getlv()+1);
					tornad.setToolTipText("<html>" + tornado.popup() + "</html>");
					torna.setText(tornado.getlv() + "/" + tornado.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			} else if(e.getSource() == imbalanc) {
				if (imbalance.getlv() < imbalance.getmax() && imbalance.getpoints() <= sorctreepoints && totalpoints > allpoints) {
					sorctreepoints ++;
					allpoints ++;
					imbalance.setcurlv(imbalance.getlv()+1);
					imbalanc.setToolTipText("<html>" + imbalance.popup() + "</html>");
					imbalan.setText(imbalance.getlv() + "/" + imbalance.getmax());
					info.setText("<html>Points Used: " + allpoints + "<br>Points Left: " + (totalpoints-allpoints) + "</html>");
				}
			}	
        }
		//avenaei mastery's below
		sorc.setText("Sorcerer(" + sorctreepoints + ")");
		if (sorctreepoints == 5) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/awakening.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        awake.setIcon((Icon) img);
		}
		if (sorctreepoints == 10) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/stylemastery.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        cross.setIcon((Icon) img);
	        recentreset = false;
		}
		if (sorctreepoints == 15) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        affin1.setIcon((Icon) img);
		}
		if (sorctreepoints == 20) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/dynamics.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        dyna1.setIcon((Icon) img);
		}
		if (sorctreepoints == 25) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        affin2.setIcon((Icon) img);
		}
		if (sorctreepoints == 30) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/dynamics.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        dyna2.setIcon((Icon) img);
		}
		if (sorctreepoints == 35) {
			ImageIcon img = new ImageIcon(getClass().getResource("/sorc/affinity.png"));
	        Image test = img.getImage();
	        Image newimg = test.getScaledInstance(40, 40,  java.awt.Image.SCALE_SMOOTH);
	        img = new ImageIcon(newimg);
	        affin3.setIcon((Icon) img);
		}
		allpoints = (sorctreepoints+Sintree.getsinpoints()+Deftree.getdefpoints()+Clertree.getclerpoints()+Zerktree.getzerkpoints());
		if (allpoints == 40) {
			if (sorctreepoints < 10 && Sintree.getsinpoints() < 10 && Clertree.getclerpoints() < 10 && Deftree.getdefpoints() < 10 && 
					Zerktree.getzerkpoints() < 10) {
				JOptionPane.showMessageDialog (null, "Error: Invalid Tree\nNone of the class trees has at least 10 points\n" +
						"Reseting",
		        			"Invalid", JOptionPane.ERROR_MESSAGE);
				Alltrees.resetall();
			}
		}
		
	}
	
	private static void createAndShowGUI() {

        JFrame.setDefaultLookAndFeelDecorated(true);
        frame = new JFrame("Cleric Skill Tree  by Avenaei(Andrew)");

        //Create and set up the content pane.
        Sorctree demo = new Sorctree();
        frame.setContentPane(demo.createContentPane());

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(560, 600);
        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        frame.setLocation((dim.width/2)-(frame.getSize().width/2), dim.height/2-frame.getSize().height/2);
        frame.setVisible(true);
    }
	public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

}
